<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 86188
  Date: 2019/1/19
  Time: 0:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改页面</title>
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <script type="text/javascript" src="/static/layuiadmin/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/jquery-3.3.1.js"></script>
    <style type="text/css">
        .layui-textarea {
            min-height: 40px;
            height: 40px;
            line-height: 17px;
            padding: 10px 9px;
            resize: vertical
        }
    </style>
</head>
<body>
<form class="layui-form" id="myform">
    <table class="layui-table" style="text-align: center">
        <tr>
            <td width="100px">创建时间</td>
            <td>
                <input type="text" name="cid" id="cid" hidden="hidden" value="${c.cid}">
                <textarea class="layui-textarea" name="creationtime" id="creationtime" lay-verify="required" cols="20" rows="1" readonly="readonly">${c.creationtime}</textarea>
            </td>
        </tr>
        <tr>
            <td>发布时间</td>
            <td>
                <textarea class="layui-textarea" name="releasetime" id="releasetime" lay-verify="required" cols="20" readonly="readonly" rows="1">${c.releasetime}</textarea>
            </td>
        </tr>
        <tr>
            <td>内容主题</td>
            <td>
                <textarea class="layui-textarea" name="theme" id="theme" lay-verify="required" cols="20" rows="1">${c.theme}</textarea>
            </td>
        </tr>
        <tr>
            <td>内容分类名称</td>
            <td>
                <textarea class="layui-textarea" name="caid" id="caid" lay-verify="required" cols="20" rows="1" >${c.category.caname}</textarea>
            </td>
        </tr>
        <tr>
            <td>发布人群</td>
            <td>
                <textarea class="layui-textarea" name="crowd" id="crowd" lay-verify="required" cols="20" rows="1" >${c.crowd}</textarea>
            </td>
        </tr>
        <tr>
            <td>发布状态</td>
            <td>
                <c:if test="${c.state == 0}">
                    <input type="radio" name="madd" value="0" title="未发布" checked="">
                    <input type="radio" name="madd" value="1" title="已发布" >
                </c:if>
                <c:if test="${c.state == 1}">
                    <input type="radio" name="madd" value="0" title="未发布">
                    <input type="radio" name="madd" value="1" title="已发布" checked="">
                </c:if>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="editButton">修改</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </td>
        </tr>
    </table>
</form>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        //监听提交
        form.on('submit(editButton)', function (data) {
            $.ajax({
                url: "updateContent",
                type: "post",
                datatype: "json",
                data: {
                    "content": JSON.stringify(data.field)
                },
                success: function (data) {
                    //获取窗口索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭窗口
                    parent.layer.close(index);
                    parent.layer.msg(data.msg);
                }
            });
            return false;
        });
    });
</script>
<script>
    layui.use('laydate',function () {
        var laydate = layui.laydate;
        //日期选择
        laydate.render({
            elem: '#test5'
            ,type: 'datetime'
        });
    })
</script>
</body>
</html>